#! /bin/sh
#### Run GBmod with CWP PostScript Graphics
#### Create Figure 5 in the GBmod paper

# model number
model=3

####  find the right directory
datadir=../datadir/

####  aux files
modelfile=${datadir}model${model}.data
rayendsfile=${datadir}rayend.data
rayfile=${datadir}ray.data
wavefile=${datadir}wave.data
wavefilet=${datadir}wavet.data

nangle=50 nxz=301 fangle=30 langle=45 nt=20

####   generate modelfile
#../Models/Xmodel0${model}

####   shoot the rays and get wavefronts
triray <$modelfile >$rayendsfile \
        rayfile=$rayfile wavefile=$wavefile \
        nangle=$nangle nxz=$nxz nt=$nt\
        fangle=$fangle langle=$langle \
        xs=0.1 zs=0.1 refseq=4,1

####  transpose wavefront file
transp <$wavefile>$wavefilet n1=$nt n2=$nangle nbpe=8

#### Create X-Windows display of model
sxplot <$modelfile -geom 600x450+0+0 tricolor=none \
        label1="Depth (km)" label2="Distance (km)" &

####  plot wave fronts
xgraph linecolor=3 <$wavefilet -geom 600x450+640+0 nplot=$nt n=$nangle \
        x1beg=0 x1end=1.0 x2beg=0 x2end=2.0 \
        label1="Depth (km)" label2="Distance (km)" title="Wavefronts" \
        style=seismic linewidth=0 mark=8 marksize=4 &

####  plot rays
xgraph linecolor=3 <$rayfile -geom 600x450+640+500 nplot=`cat outpar` n=$nxz \
        x1beg=0 x1end=1.0 x2beg=0 x2end=2.0 \
        label1="Depth (km)" label2="Distance (km)" title="Raypaths" \
        style=seismic linecolor=3 &


exit 0
